/*
 * @Description: 公共mixins
 *
 * @Author: XiongYaoYuan<xiongyaoyuan>
 * @Date: 2023-08-08 15:39:31
 * @FilePath: /yuxiuproweb/src/utils/mixins/common.js
 */
export default {
  data() {
    return {
      maxHeight: 500,
      timerTime: null,
    };
  },
  computed: {
    showSearchState() {
      return this?.showSearch;
    },
  },
  watch: {
    showSearchState(val) {
      this.getMaxHeight();
    },
  },
  mounted() {
    const _this = this;
    // 页面加载的时候设置table的高度
    this.$nextTick(() => {
      _this.getMaxHeight();
    });
    // 页面大小该变的时候（缩放页面）设置table的高度（可加可不加）
    window.onresize = () => {
      this.$nextTick(() => {
        _this.getMaxHeight();
      });
    };
  },
  methods: {
    getMaxHeight() {
      if (this.timerTime) clearTimeout(this.timerTime);
      this.timerTime = setTimeout(() => {
        this.maxHeight = this.tableHeight(this, 220, "queryForm");
      }, 100);
    },
  },
};
